package cxt.cn.springcloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Auther: ChengXiaotian
 * @Date: 2020-06-22 10:46
 * @Description:
 */
@RestController
public class nacosController {

    @Autowired
    private RestTemplate restTemplate;
    @Value("${service-url.nacos-user-service}")
    private String serverurl;

    @GetMapping("/consumer/echo/{id}")
    public String echo(@PathVariable Long id) {
         return restTemplate.getForObject(serverurl+"/echo/"+id,String.class);
    }
}
